////////////////////////////////////////////////////////////////////////////////
//
//  Copyright 2010 galaxy.org
//
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//
//  http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////

package org.galaxy.richflex.utils
{
	import mx.core.FlexGlobals;
	import mx.styles.CSSStyleDeclaration;
	import mx.styles.StyleManager;

	/**
	 * Style helper class. There are some useful functions about style operations,
	 * such as sets global style.
	 * 
	 * @author Cheng Liang
	 * 
	 * @version 0.0.1 create 2010-9-15;
	 * @version 0.0.1a renamed from <code>StyleUtils</code> to <code>StyleHelper</code> 2010-9-27;
	 */
	public class StyleHelper
	{
		
		/**
		 * Sets global styles.
		 * 
		 * @param style style name
		 * @param value style value
		 */
		public static function setGlobalStyle(style : String, value : *) : void
		{
			var cssDecl:CSSStyleDeclaration = StyleManager.getStyleManager(FlexGlobals.topLevelApplication.moduleFactory).getStyleDeclaration("global");
			if (!cssDecl) {
				cssDecl = new CSSStyleDeclaration("global");
			}
			cssDecl.setStyle(style, value);
		}
		
		public function StyleHelper()
		{
		}
	}
}
